package com.topwalk.iwp.multiService.action;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.topwalk.iwp.multiService.dao.MultiServiceDao;
import com.topwalk.ws.multiService.PeopleServiceItem;

/**
 * Servlet implementation class ServiceListAction
 */
public class ServiceListAction extends HttpServlet {
	private static final long serialVersionUID = 1L;

	@Override
	protected void service(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		// get service list;
		@SuppressWarnings("unchecked")
		List<PeopleServiceItem> peopleServiceList = (List<PeopleServiceItem>) req
				.getSession().getAttribute("serviceList");
		if (null == peopleServiceList) {
			peopleServiceList=MultiServiceDao.getPeopleServiceList(null);
			req.getSession().setAttribute("serviceList", peopleServiceList);
		}
		req.setAttribute("serviceList", peopleServiceList);
		req.getRequestDispatcher("demo.jsp").forward(req, resp);
	}
 }
